/**
 * DBUtil.java
 *
 *
 * $LastChangedBy: allen $
 * $LastChangedDate: 2007-12-07 15:49:27 +0800 $
 * $Revision: 1402 $
 */
package com.myspace.common.util;

/**
 *
 * @author Allen.Chen
 *
 */
public class DBUtil {

	public static String prepareString(String sql, int length) {
		if (length <= 0)
			return null;
		StringBuffer sb = new StringBuffer(sql);
		if (length == 1)
			sb.append("=?");
		else {
			sb.append(" in(?");
			for (int i = 0; i < length - 1; i++) {
				sb.append(",?");
			}
			sb.append(") ");
		}
		return sb.toString();
	}
}
